Path 1: 6 calls (0.4)

Style (6)

'fill: #c5c8c6' (6)

1def get_svg_style(style: Style) -> str:
2            """Convert a Style to CSS rules for SVG."""
3            if style in style_cache:
4                return style_cache[style]
5            css_rules = []
6            color = (
7                _theme.foreground_color
8                if (style.color is None or style.color.is_default)
9                else style.color.get_truecolor(_theme)
10            )
11            bgcolor = (
12                _theme.background_color
13                if (style.bgcolor is None or style.bgcolor.is_default)
14                else style.bgcolor.get_truecolor(_theme)
15            )
16            if style.reverse:
17                color, bgcolor = bgcolor, color
18            if style.dim:
19                color = blend_rgb(color, bgcolor, 0.4)
20            css_rules.append(f"fill: {color.hex}")
21            if style.bold:
22                css_rules.append("font-weight: bold")
23            if style.italic:
24                css_rules.append("font-style: italic;")
25            if style.underline:
26                css_rules.append("text-decoration: underline;")
27            if style.strike:
28                css_rules.append("text-decoration: line-through;")
29
30            css = ";".join(css_rules)
31            style_cache[style] = css
32            return css
            

Path 2: 6 calls (0.4)

Style (6)

'fill: #c5c8c6' (6)

1def get_svg_style(style: Style) -> str:
2            """Convert a Style to CSS rules for SVG."""
3            if style in style_cache:
4                return style_cache[style]
5            css_rules = []
6            color = (
7                _theme.foreground_color
8                if (style.color is None or style.color.is_default)
9                else style.color.get_truecolor(_theme)
10            )
11            bgcolor = (
12                _theme.background_color
13                if (style.bgcolor is None or style.bgcolor.is_default)
14                else style.bgcolor.get_truecolor(_theme)
15            )
16            if style.reverse:
17                color, bgcolor = bgcolor, color
18            if style.dim:
19                color = blend_rgb(color, bgcolor, 0.4)
20            css_rules.append(f"fill: {color.hex}")
21            if style.bold:
22                css_rules.append("font-weight: bold")
23            if style.italic:
24                css_rules.append("font-style: italic;")
25            if style.underline:
26                css_rules.append("text-decoration: underline;")
27            if style.strike:
28                css_rules.append("text-decoration: line-through;")
29
30            css = ";".join(css_rules)
31            style_cache[style] = css
32            return css
            

Path 3: 3 calls (0.2)

Style (3)

'fill: #608ab1;font-weight: bold' (3)

1def get_svg_style(style: Style) -> str:
2            """Convert a Style to CSS rules for SVG."""
3            if style in style_cache:
4                return style_cache[style]
5            css_rules = []
6            color = (
7                _theme.foreground_color
8                if (style.color is None or style.color.is_default)
9                else style.color.get_truecolor(_theme)
10            )
11            bgcolor = (
12                _theme.background_color
13                if (style.bgcolor is None or style.bgcolor.is_default)
14                else style.bgcolor.get_truecolor(_theme)
15            )
16            if style.reverse:
17                color, bgcolor = bgcolor, color
18            if style.dim:
19                color = blend_rgb(color, bgcolor, 0.4)
20            css_rules.append(f"fill: {color.hex}")
21            if style.bold:
22                css_rules.append("font-weight: bold")
23            if style.italic:
24                css_rules.append("font-style: italic;")
25            if style.underline:
26                css_rules.append("text-decoration: underline;")
27            if style.strike:
28                css_rules.append("text-decoration: line-through;")
29
30            css = ";".join(css_rules)
31            style_cache[style] = css
32            return css